package cn.edu.scau.cmi.liangzijian.composite.safe;

public class SafePerson implements SafeOrganization {
	
	private String name;
	
	private SafeOrganization parent;
	
	public SafePerson(String name) {
		this.name = name;
	}

	@Override
	public void say() {
		System.out.println("我的名字是："+name);
	}
	
	@Override
	public void setName(String name) {
		this.name = name;
	}
	
	@Override
	public String getName() {
		return name;
	}	
	
	@Override
	public boolean equals(Object obj) {
		return name.equals(((SafePerson)obj).name);
	}
	
	@Override
	public int hashCode() {
		return name.hashCode();
	}

	@Override
	public void setParent(SafeOrganization parent) {
		this.parent = parent;
	}

	@Override
	public SafeOrganization getParent() {
		return parent;
	}
}
